<?php

namespace app\services;

use plugin\admin\app\model\Article;

class ArticleService
{
    public static function detail($identifyKey, $language = 'zh')
    {
        $data = Article::where('identify_key', $identifyKey)->first();

        $data['content'] = replace_content($data['content']);
        $data['en_content'] = replace_content($data['content']);

        $data['title'] = get_current_language() == 'zh' ? $data['title'] : $data['en_title'];
        $data['content'] = get_current_language() == 'zh' ? $data['content'] : $data['en_content'];

        return $data;
    }
}